home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / ada / gnat1792.zip / gnat179b / t-adainc / s-tcmasp.adb < prev    next >
Text File  |  1994-05-19  |  3KB  |  54 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                 GNU ADA RUNTIME LIBRARY (GNARL) COMPONENTS               --
  4. --                                                                          --
  5. --  S Y S T E M . T A S K _ C L O C K . M A C H I N E _ S P E C I F I C S   --
  6. --                                                                          --
  7. --                                  B o d y                                 --
  8. --                                                                          --
  9. --                             $Revision: 1.3 $                             --
  10. --                                                                          --
  11. --           Copyright (c) 1991,1992,1993, FSU, All Rights Reserved         --
  12. --                                                                          --
  13. --  GNARL is free software; you can redistribute it and/or modify it  under --
  14. --  terms  of  the  GNU  Library General Public License as published by the --
  15. --  Free Software Foundation; either version 2,  or (at  your  option)  any --
  16. --  later  version.   GNARL is distributed in the hope that it will be use- --
  17. --  ful, but but WITHOUT ANY WARRANTY; without even the implied warranty of --
  18. --  MERCHANTABILITY  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Gen- --
  19. --  eral Library Public License for more details.  You should have received --
  20. --  a  copy of the GNU Library General Public License along with GNARL; see --
  21. --  file COPYING. If not, write to the Free Software Foundation,  675  Mass --
  22. --  Ave, Cambridge, MA 02139, USA.                                          --
  23. --                                                                          --
  24. ------------------------------------------------------------------------------
  25.  
  26. with System.POSIX_Timers;
  27. --  Used for, POSIX_Timers.clock_gettime,
  28. --            POSIX_Timers.CLOCK_REALTIME
  29.  
  30. package body System.Task_Clock.Machine_Specifics is
  31.  
  32.    -----------
  33.    -- Clock --
  34.    -----------
  35.  
  36.    function Clock return Stimespec is
  37.       Now    : POSIX_Timers.timespec;
  38.       Result : Integer;
  39.  
  40.    begin
  41.       POSIX_Timers.clock_gettime (POSIX_Timers.CLOCK_REALTIME, Now, Result);
  42.       return
  43.         Stimespec'(Val => Stimespec_Sec_Unit.Val * Time_Base (Now.tv_sec) +
  44.                    Time_Base (Now.tv_nsec));
  45.    end Clock;
  46.  
  47. begin
  48.    Stimespec_Ticks := Time_Of (0, 1000000);
  49.    --  Sun os 4.1 has clock resoultion of 10ms. ??? target specific ???
  50.  
  51.    Stimespec_Impl_Max := Time_Of (800000000, 0);
  52.    --  Maximum Time value for SPARC (not exact). Should be  modified.
  53. end System.Task_Clock.Machine_Specifics;
  54.